<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/default.css">
<link rel="stylesheet" type="text/css" href="css/locations.css">
<link rel="stylesheet" type="text/css" href="css/admin.css">
<link rel="icon"          type="image/png" href="images/icons/logo.png" />
<link rel="shortcut icon" type="image/png" href="images/icons/logo.png" />
<script type="text/javascript" src="scripts/default.js"></script>
<script type="text/javascript" src="scripts/maps.js"></script>

<title>Thai Kitchen - Add/Edit Menu Item</title>
</head>
  <body>
    <%@include file="header.inc"%>
    <div id="ie6pagecontainer">
      <div id="container">
        <div id="content" style="width: 100%;">
          <h2>Add/Edit Menu Item</h2>
          <form method="post" action="Edit%20Menu?id=${menuItem.id}">
            <table class="input">
              <tr><td>Name</td><td><input type="text"        name="name"        value="${menuItem.name}" /></td></tr>
              <tr><td>Number</td><td><input type="text"      name="number"      value="${menuItem.number}" /></td></tr>
              <tr>
                <td>Description</td>
                <td>
                  <textarea rows="4" cols="32" name="description">${menuItem.description}</textarea>
                </td>
              </tr>
              <tr><td>Price</td><td><input type="text"       name="price"       value="${menuItem.price}" /></td></tr>
              <tr>
                <td>Category</td>
                <td>
                  <select name="category">
                    <c:forEach var='category' items='${categories}'>
                      <c:choose>
                        <c:when test="${menuItem.category.name == category.name}">
                          <c:set var="isSelected" value=" selected"></c:set>
                        </c:when>
                        <c:otherwise>
                          <c:set var="isSelected" value=""></c:set>
                        </c:otherwise>
                      </c:choose>
                      <option value="${category.name}"${isSelected}>${category.name}</option>
                    </c:forEach>
                  </select>
                </td>
              </tr>
              <c:forEach var='tag' items='${menuItem.tags}'>
                <c:if test="${tag.name == 'special'}">
                  <c:set var="isSpecial" value="checked"></c:set>
                </c:if>
                <c:if test="${tag.name == 'spicy'}">
                  <c:set var="isSpicy" value="checked"></c:set>
                </c:if>
                <c:if test="${tag.name == 'vegetarian'}">
                  <c:set var="isVegetarian" value="checked"></c:set>
                </c:if>
              </c:forEach>
              <tr><td>Spicy</td><td><input      type="checkbox" ${isSpicy}      name="tags" value="spicy" /></td></tr>
              <tr><td>Vegetarian</td><td><input type="checkbox" ${isVegetarian} name="tags" value="vegetarian" /></td></tr>
              <tr><td>Special</td><td><input    type="checkbox" ${isSpecial}    name="tags" value="special" /></td></tr>
              <tr>
                <td colspan="2" style="text-align: center">
                  <button type="submit" title="Adds a new item to the menu">
                    <img src="images/icons/disk.png" /> Save
                  </button>
                </td>
              </tr>
            </table>
          </form>
        </div>
      </div>
    </div>
    <%@include file="footer.inc"%>
  </body>
</html>